package com.nicolaspigelet.dopplrclient.UI 
{
	import com.dopplr.api.Traveller;
	import flash.display.Bitmap;
	import flash.display.Loader;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.filters.DropShadowFilter;
	import flash.net.URLRequest;
	import flash.text.Font;
	
	/**
	 * @author Nicolas Pigelet aka tanaki
	 */
	public class FellowUI extends Sprite
	{
		private var __coolvetica:Font;
		private var __container:Sprite;
		private var __img:Loader;
		private var __urRequest:URLRequest;
		
		public function FellowUI(fellow:Traveller) 
		{
			__coolvetica = new Coolvetica();
			
			__container = new Sprite();
			__container.graphics.beginFill(0xffffff);
			__container.graphics.drawRect(0, 0, 55, 55);
			__container.filters = [new DropShadowFilter(2, 45, 0, .4, 6, 6, 1, 3)];
			
			addChild(__container);
			
			__img = new Loader();
			__urRequest = new URLRequest(fellow.iconURL);
			__img.contentLoaderInfo.addEventListener(Event.COMPLETE, __displayIcon);
			__img.load(__urRequest);
		}
		
		private function __displayIcon(e:Event):void 
		{
			var bmp : Bitmap = Bitmap(__img.content);
			bmp.x = 10;
			bmp.y = 10;
			addChild(bmp);
		}
		
	}

}